using System;


namespace Handrise.BasicModal.Serialization.Attributes
{
    /// <summary>
    /// This attribute is used to override temporary normal serialization behaviour.
    /// Using this attribute on a field of a serializable class, the user is telling
    /// to CompactFormatter to serialize this field using serialization policy 
    /// implemented into another class (the customSerializer passed as parameter).
    /// This attribute can be seen as a way to implement a custom serialization policy
    /// also on those classes which are not under direct control of final user.
    /// NOTICE: Data about component containing custom serialization mechanism must
    /// be serialized on the wire with the field, this means that this attribute
    /// should be used only when it's really necessary: if user implements a class
    /// and wants to give it custom serialization it's better to use Custom
    /// named parameter of Serializable attribute.
    /// </summary>
    [AttributeUsage(AttributeTargets.Class)]
    public class OverriderAttribute : Attribute
    {

        private Type customSerializer;

        public Type CustomSerializer
        {
            get
            {
                return customSerializer;
            }
        }

        public OverriderAttribute(Type customSerializer)
        {
            this.customSerializer = customSerializer;
        }
    }
}
